home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
vsix60.exe
/
lha
/
VERNDEMO.PRG
< prev
next >
Wrap
Text File
|
1991-02-02
|
52KB
|
1,227 lines
* Filename......: VernDemo.Prg
*
* Author........: Vernon E. Six, Jr.
* 2908 Forest Hollow Lane #2329
* Arlington, Texas 76006
* Ph: (214) 437-7949 - Voice
* Ph: (817) 695-0050 - BBS
*
* Last Update...: Fri 02-01-1991 10:39:21
*
* Notice........: Copyright (c) 1989-90 by Vernon E. Six, Jr.
* All Rights Reserved World Wide
*
* Version.......: Clipper Summer 87 & v5.0
*
* Purpose.......: Demonstation program for VERNSIX.LIB
*****
* Define variables for VMENU()
*****
PRIVATE al_Avail[70] && What ones are available?
PRIVATE ac_options[70] && Character array of options
PRIVATE an_start[10] && Corresponds to each menu's number of options
PRIVATE an_end[10] && ""
PRIVATE ac_msgs[20] && Message for bottom of screen (top row of menu)
PRIVATE ac_Title[4] && Title for menus
PRIVATE n_Title && Number of lines in title array
PRIVATE n_cntr && Misc use
PRIVATE n_top && Used with GETCOORD demo
PRIVATE n_left && Used with GETCOORD demo
PRIVATE n_bottom && Used with GETCOORD demo
PRIVATE n_right && Used with GETCOORD demo
PRIVATE ac_Msg[20] && For DISPMSG()
PRIVATE l_DbfOpen && .T. if SAMPLE.DBF was opened properly
&& otherwise .F.
PRIVATE n_Value
PRIVATE d_Date
INITVERN() && Initialize my library
INITHELP() && Open the help files in next work area
EXTERNAL HELP && Help the linker find HELP.PRG
EXTERNAL MAKEHLP && Help the linker find MAKEHLP.PRG
EXTERNAL GETCOORD
SET KEY 28 TO HELP && <F1>
SET KEY 291 TO MAKEHLP && <Alt-H>
SET KEY 294 TO FAKELOCK && <Alt-L>
NEWSCRN()
*****
*
* I like to indent the GRABSCRN() and PUTSCRN() functions, so I don't forget
* to include a PUTSCRN() for every GRABSCRN()
*
*****
SET CURSOR OFF
GRABSCRN()
ac_Msg[1] = " Vern Six's Clipper ToolBox v6.00 Sat 02-02-1991 "
ac_Msg[2] = " "
ac_Msg[3] = " Copyright (c) 1988-91 by Vernon E. Six, Jr. "
ac_Msg[4] = " All Rights Reserved World Wide "
ac_Msg[5] = " "
ac_Msg[6] = " Vernon E. Six, Jr. "
ac_Msg[7] = " 2908 Forest Hollow Lane #2329 "
ac_Msg[8] = " Arlington, Texas 75080 "
ac_Msg[9] = " Ph: (214) 437-7949 - VOICE "
ac_Msg[10] = " Ph: (817) 695-0058 - BBS "
DISPMSG(ac_Msg,10,"","")
SET CURSOR OFF
INKEY(5)
PUTSCRN()
GRABSCRN()
ac_Msg[1] = "Welcome to the Vern Six Clipper Toolbox!! "
ac_Msg[2] = " "
ac_Msg[3] = "What you are about to see is a demonstration "
ac_Msg[4] = "of some of the capabilities made possible via "
ac_Msg[5] = "this library. "
ac_Msg[6] = " "
ac_Msg[7] = "For the most part, you will probably not be "
ac_Msg[8] = "able to see much from just using this demo. "
ac_Msg[9] = "You should look at and STUDY the source code "
ac_Msg[10] = "to really get a feel for what is taking place "
ac_Msg[11] = "in this program and how to access VERNSIX.LIB."
DISPMSG(ac_Msg,11," Vern Six's Clipper Toolbox v6.00 "," Press any key to continue ")
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[1] = " VERNSIX.LIB comes complete with 34 fully operational "
ac_Msg[2] = " functions and procedures that you can add to your "
ac_Msg[3] = " Clipper application with very little effort. "
ac_Msg[4] = " "
ac_Msg[5] = " Each function is described in detail in the file "
ac_Msg[6] = " called VERNSIX.DOC. To print this file on your "
ac_Msg[7] = " printer, merely issue the following command at the "
ac_Msg[8] = " DOS prompt: "
ac_Msg[9] = " "
ac_Msg[10] = " C> COPY VERNSIX.DOC PRN [Return] "
ac_Msg[11] = " "
ac_Msg[12] = " In addition to VERNSIX.DOC, a Norton Guides Database "
ac_Msg[13] = " has been included (VERNSIX.NG). "
DISPMSG(ac_Msg,13,""," Press any key to continue ")
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[1] = "The rest of this demonstration is merely a series of"
ac_Msg[2] = "pull-down menus. You can move from one pull-down "
ac_Msg[3] = "menu to the other, by the use of the left and right "
ac_Msg[4] = "arrow keys. To 'pull a menu down', press [Return]. "
ac_Msg[5] = "Once you highlight the function you want to see "
ac_Msg[6] = "demonstrated, simply press [Return]. "
ac_Msg[7] = " "
ac_Msg[8] = "Note: Not all functions can be demonstrated from a "
ac_Msg[9] = "'visual perspective'. In these cases, a dialog "
ac_Msg[10] = "window will appear to tell you what is taking place."
ac_Msg[11] = " "
ac_Msg[12] = "Be sure to STUDY VERNDEMO.PRG to see what is taking "
ac_Msg[13] = "place behind the scenes. "
DISPMSG(ac_Msg,13,"", " Press any key to continue ")
INKEY(0)
PUTSCRN()
*****
* Open SETUP.DBF for database functional demos
*****
SELECT 0
l_DbfOpen = .F.
BEGIN SEQUENCE
IF .NOT. OPEN_DBF("SAMPLE")
GRABSCRN()
ac_Msg[1] = " Could not gain access to 'SAMPLE.DBF' "
ac_Msg[2] = " "
ac_Msg[3] = "Database function demonstrations disabled"
DISPMSG(ac_Msg,3,""," Press any key to continue ")
SET CURSOR OFF
INKEY(0)
SET CURSOR ON
PUTSCRN()
USE
BREAK
ENDIF
IF .NOT. FILE("SAMPLE"+INDEXEXT())
IF .NOT. SHOW_NTX("SAMPLE","AUTHORLAST+AUTHORFRST")
GRABSCRN()
ac_Msg[1] = " Could not gain access to 'SAMPLE.DBF' "
ac_Msg[2] = " "
ac_Msg[3] = "Database function demonstrations disabled"
DISPMSG(ac_Msg,3,""," Press any key to continue ")
SET CURSOR OFF
INKEY(0)
SET CURSOR ON
PUTSCRN()
USE
BREAK
ENDIF
ENDIF
SET INDEX TO SAMPLE
*****
* The database functions (VEDIT(), VPICK(), etc) will be disabled
* if the following variable isn't set to .T. And we only set this
* variable to .T. if the open and index function went smoothly.
*****
l_DbfOpen = .T.
END SEQUENCE
*****
*
* Setup the VMENU() stuff
*
*****
*****
* Title array
*****
ac_Title[1] = ""
ac_Title[2] = "CopyRight (c) 1988-91 by Vernon E. Six, Jr."
ac_Title[3] = "All Rights Reserved World Wide"
ac_Title[4] = ""
n_title = 4
*****
* Setup the array of available options
*****
FOR n_Cntr = 1 TO 70
al_Avail[n_Cntr] = .T.
NEXT n_Cntr
******
* Setup the messages for the top row on the VMENU() panel
******
ac_Msgs[1] = "General Functions"
ac_Msgs[2] = "Functions dealing with the user interface portion of an application"
ac_Msgs[3] = "PRIVATE Area Networking (multi-user) application functions"
ac_Msgs[4] = "Information about building 'context sensitive' help screens"
ac_Msgs[5] = "Functions dealing with normal 'database' operations"
ac_Msgs[6] = "Other functions and information"
*****
* Define top menu (the one across the top)
*****
an_start[1] = 1
an_end[1] = 6
ac_options[1] = " General "
ac_options[2] = " Input/Output "
ac_options[3] = " Network "
ac_options[4] = " Help "
ac_options[5] = " Database "
ac_options[6] = " Other "
*****
* First pull-down - General
*****
an_start[2] = 10
an_end[2] = 12
ac_options[10] = " FSELECT() "
ac_options[11] = " INITVERN() "
ac_options[12] = " VERNVERS() "
*****
* Second pull-down - Input/Output
*****
an_start[3] = 15
an_end[3] = 30
ac_options[15] = " ASK() "
ac_options[16] = " ASK2() "
ac_options[17] = " CENTER() "
ac_options[18] = " DISPMSG() "
ac_options[19] = " DOL2STR() "
ac_options[20] = " DTOT() "
ac_options[21] = " GETCOLOR() "
ac_options[22] = " GETCOORD "
ac_options[23] = " GRABSCRN() "
ac_options[24] = " NEWSCRN() "
ac_options[25] = " NUM2TEXT() "
ac_options[26] = " PUTSCRN() "
ac_options[27] = " TEXTCOLR() "
ac_options[28] = " VMENU() "
ac_options[29] = " VWIND() "
ac_options[30] = " WINDCOLR() "
*****
* Third pull-down - Network
*****
an_start[4] = 35
an_end[4] = 39
ac_options[35] = " FAKELOCK "
ac_options[36] = " V_APPEND() "
ac_options[37] = " V_FLOCK() "
ac_options[38] = " V_RLOCK() "
ac_options[39] = " V_USE() "
*****
* Fourth pull-down - Help
*****
an_start[5] = 45
an_end[5] = 47
ac_options[45] = " HELP "
ac_options[46] = " INITHELP() "
ac_options[47] = " MAKEHLP "
*****
* Fifth pull-down - Database
*****
an_start[6] = 50
an_end[6] = 55
ac_options[50] = " ADD_FLD() "
ac_options[51] = " OPEN_DBF() "
ac_options[52] = " SHOW_NTX() "
ac_options[53] = " VEDIT() "
ac_options[54] = " VFILT() "
ac_options[55] = " VPICK() "
*****
* Sixth pull-down - Other
*****
an_start[7] = 60
an_end[7] = 63
ac_options[60] = " Color settings "
ac_options[61] = " A special thanks... "
ac_options[62] = " Ordering Information "
ac_options[63] = " Quit "
*****
* Start at the top line with no "pull-downs" pulled down
*****
gn_pulldown = 0
gn_option = 0
SET WRAP ON
DO WHILE .T.
n_opt = VMENU(ac_options,an_start,an_end,ac_msgs,ac_title,n_title,al_Avail)
DO CASE
CASE n_opt = 10 && FSELECT()
ac_Msg[1] = " FSELECT() allows you to query the user for a "
ac_Msg[2] = " filename matching a wildcard specification. The "
ac_Msg[3] = " user will be able to move a light bar to the "
ac_Msg[4] = " filename that he/she wishes to select. "
ac_Msg[5] = " ══════════════════════════════════════════════════ "
ac_Msg[6] = " Select a file from the list on the right. "
DISPMSG(ac_Msg,6," FSELECT() ","",5,1)
c_choice = FSELECT("*.*",5,60,15,"","")
IF .NOT. EMPTY(c_choice)
ac_Msg[1] = " You selected " + c_choice
DISPMSG(ac_Msg,1,"","")
INKEY(3)
ENDIF
CASE n_opt = 11 && INITVERN()
ac_Msg[1] = " INITVERN() initializes the variables used by the "
ac_Msg[2] = " various functions in this library as well as sets "
ac_Msg[3] = " the colors from the configuration database or creates "
ac_Msg[4] = " the configuration database if it doesn't exist. "
DISPMSG(ac_Msg,4," INITVERN() "," Press any key to continue ")
INKEY(0)
CASE n_Opt = 12 && VERNVERS()
ac_Msg[1] = " VERNVERS() is used structly to indentify which version "
ac_Msg[2] = " of the library you are using. The author of VERNSIX.LIB "
ac_Msg[3] = " will need this information should you call for technical "
ac_Msg[4] = " support."
DISPMSG(ac_Msg,4," VERNVERS() "," Press any key to continue ")
INKEY(0)
CASE n_opt = 15 && ASK()
ac_Msg[1] = " ASK() prompts the user with a one line question. "
ac_Msg[2] = " ASK() will return a one character response which "
ac_Msg[3] = " can be limited to specific characters. ASK() is "
ac_Msg[4] = " non-screen destructive. "
ac_Msg[5] = " ══════════════════════════════════════════════════ "
ac_Msg[6] = " Press any key to see a demonstration of ASK() "
DISPMSG(ac_Msg,6," ASK() ", "")
INKEY(0)
c_choice = ASK("DEMO: Do you want to continue","YyNn")
CASE n_opt = 16 && ASK2()
ac_Msg[1] = " ASK2() prompts the user with a multiple line "
ac_Msg[2] = " question. ASK2() will return a one character "
ac_Msg[3] = " response which can be limited to specific "
ac_Msg[4] = " characters. ASK2() is non-screen destructive. "
ac_Msg[5] = " ══════════════════════════════════════════════════ "
ac_Msg[6] = " Press any key to see a demonstration of ASK2() "
DISPMSG(ac_Msg,6," ASK2() ", "")
INKEY(0)
ac_Msg[1] = "DEMO: This is line one of the multi-line question"
ac_Msg[2] = "DEMO: Do you want to continue"
c_choice = ASK2(ac_Msg,2,"","","YyNn")
CASE n_opt = 17 && CENTER()
ac_Msg[1] = " CENTER() allows you to center a string within a "
ac_Msg[2] = " given width. "
DISPMSG(ac_Msg,2," CENTER() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 18 && DISPMSG()
ac_Msg[1] = " Displays a message in a window (centered on the "
ac_Msg[2] = " screen). The programmer can supply optional top "
ac_Msg[3] = " left coordinates for the window. This message is "
ac_Msg[4] = " being displayed by DISPMSG(). "
DISPMSG(ac_Msg,4," DISPMSG() " , " Press any key to continue ")
INKEY(0)
CASE n_Opt = 19 && DOL2STR()
ac_Msg[1] = " DOL2STR() takes a numeric amount (similar to that on most "
ac_Msg[2] = " checks) and converts it to a 'long-hand' representation "
ac_Msg[3] = " of that number."
ac_Msg[4] = " ═════════════════════════════════════════════════════════ "
ac_Msg[5] = " Press any key to see a demonstration of DOL2STR() "
DISPMSG(ac_Msg,5," DOL2STR() ", "")
INKEY(0)
NEWSCRN()
VWIND(11,10,13,60," DOL2STR() ","")
n_Value = 0.00
SET CURSOR ON
@ 12,12 SAY "Please enter a numeric amount:" GET n_Value
READ
SET CURSOR OFF
NEWSCRN()
ac_Msg[1] = "Your number was..."
ac_Msg[2] = DOL2STR(n_Value)
DISPMSG(ac_Msg,2," DOL2STR() "," Press any key to continue ")
INKEY(0)
CASE n_Opt = 20 && DTOT()
ac_Msg[1] = " DTOT() converts a date expression to a specific "
ac_Msg[2] = " character format. The programmer can request a "
ac_Msg[3] = " specific format to convert to. "
ac_Msg[4] = " i.e. Month Date, Year (January 28, 1991) or "
ac_Msg[5] = " Date Mon Year (28 JAN 91) "
ac_Msg[6] = " ═══════════════════════════════════════════════ "
ac_Msg[7] = " Press any key to see a demonstration of DTOT() "
DISPMSG(ac_Msg,7," DTOT() ", "")
INKEY(0)
NEWSCRN()
VWIND(11,10,13,60," DTOT() ","")
d_Date = DATE()
SET CURSOR ON
@ 12,12 SAY "Please enter a date:" GET d_Date
READ
SET CURSOR OFF
NEWSCRN()
ac_Msg[1] = "Your date converts to... "
ac_Msg[2] = "Style #1: " + DTOT(d_Date,1)
ac_Msg[3] = "Style #2: " + DTOT(d_Date,2)
DISPMSG(ac_Msg,3," DTOT() "," Press and key to continue ")
INKEY(0)
CASE n_opt = 21 && GETCOLOR()
ac_Msg[1] = " Prompts the user for the various color schemes "
ac_Msg[2] = " (text and windowed) that he/she wants to use in "
ac_Msg[3] = " your program. "
ac_Msg[4] = " ══════════════════════════════════════════════════ "
ac_Msg[5] = " Press any key to see a demonstration of GETCOLOR() "
DISPMSG(ac_Msg,5," GETCOLOR() ", "")
INKEY(0)
GETCOLOR()
CASE n_opt = 22 && GETCOORD()
GRABSCRN()
ac_Msg[01] = " Allows the user to size a box on the screen "
ac_Msg[02] = " through the use of the cursor control keys. "
ac_Msg[03] = " Returns the top,left and bottom,right coordinates "
ac_Msg[04] = " to your program. "
DISPMSG(ac_Msg,4," GETCOORD() ", " Press any key to continue ")
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " When this procedure is called you will see a box "
ac_Msg[02] = " appear on the screen (at the starting coordinates "
ac_Msg[03] = " you specified). The cursor will be in the upper "
ac_Msg[04] = " left hand corner of the box. You may move the "
ac_Msg[05] = " corner around the screen by using the cursor "
ac_Msg[06] = " control keys. "
DISPMSG(ac_Msg,6," GETCOORD() ", " Press any key to continue ")
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " If you press the [HOME] key, the cursor will move "
ac_Msg[02] = " from the upper left corner of the box to the lower "
ac_Msg[03] = " right corner. You can now move this corner of the "
ac_Msg[04] = " box around the screen by using the cursor control "
ac_Msg[05] = " keys. Pressing the [HOME] key will once again "
ac_Msg[06] = " place the cursor in the upper left corner of the "
ac_Msg[07] = " box. "
ac_Msg[08] = " "
ac_Msg[09] = " When the box is the size and is in the location "
ac_Msg[10] = " you want, press the [RETURN] key. "
ac_Msg[11] = " ══════════════════════════════════════════════════ "
ac_Msg[12] = " Press any key to see a demonstration of GETCOORD() "
DISPMSG(ac_Msg,12," GETCOORD() ", "")
INKEY(0)
n_top = 5
n_left = 10
n_bottom = 20
n_right = 70
DO GETCOORD WITH n_top, n_left, n_bottom, n_right
PUTSCRN()
CASE n_opt = 23 && GRABSCRN()
ac_Msg[01] = " Captures contents of the screen (including cursor "
ac_Msg[02] = " location, screen attributes, etc.) to be used in "
ac_Msg[03] = " conjunction with PUTSCRN(). "
ac_Msg[04] = " "
ac_Msg[05] = " Clipper's SAVE SCREEN command doesn't quite fit "
ac_Msg[06] = " the bill for most screen save operations. i.e. "
ac_Msg[07] = " it doesn't save the cursor position or screen "
ac_Msg[08] = " attributes. GRABSCRN() saves all these important "
ac_Msg[09] = " aspects of your screen and will restore them "
ac_Msg[10] = " properly when you call PUTSCRN(). "
DISPMSG(ac_Msg,10," GRABSCRN() ", " Press any key to continue ")
INKEY(0)
CASE n_Opt = 24 && NEWSCRN()
ac_Msg[1] = " NEWSCRN() is a quick and dirty little function to "
ac_Msg[2] = " clear the screen and paint a 'pretty' background. "
ac_Msg[3] = " NEWSCRN() makes a call to TEXTCOLR() before "
ac_Msg[4] = " returning to your calling program."
DISPMSG(ac_Msg,4," NEWSCRN() ", " Press any key to continue ")
INKEY(0)
CASE n_Opt = 25 && NUM2TEXT()
ac_Msg[1] = " NUM2TEXT() converts a numeric value to a character "
ac_Msg[2] = " value. i.e. 123 becomes One-Hundred Twenty Three "
ac_Msg[3] = " NUM2TEXT() is very similar to DOL2STR() but does "
ac_Msg[4] = " not format the return string to 'dollars and "
ac_Msg[5] = " cents'. "
DISPMSG(ac_Msg,5," NUM2TEXT() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 26 && PUTSCRN()
ac_Msg[01] = " Restores a screen captured with GRABSCRN() "
DISPMSG(ac_Msg,1," PUTSCRN() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 27 && TEXTCOLR()
ac_Msg[01] = " Sets color to normal text colors as defined by the "
ac_Msg[02] = " configuration database. You can change the colors "
ac_Msg[03] = " via the GETCOLOR() function. "
DISPMSG(ac_Msg,3," TEXTCOLR() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 28 && VMENU()
ac_Msg[01] = " Provides the programmer with a very fast and "
ac_Msg[02] = " efficient means of producing 'pull-down' menus for "
ac_Msg[03] = " their users. VMENU() is screen destructive. "
ac_Msg[04] = " "
ac_Msg[05] = " The menu used during this demonstration program was "
ac_Msg[06] = " created with VMENU(). "
DISPMSG(ac_Msg,6," VMENU() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 29 && VWIND()
ac_Msg[01] = " Draws a window with optional shadow, color and "
ac_Msg[02] = " custom box "
ac_Msg[03] = " "
ac_Msg[04] = " All the windows you see during this demonstration "
ac_Msg[05] = " have been created with VWIND(). "
DISPMSG(ac_Msg,5," VWIND() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 30 && WINDCOLR()
ac_Msg[01] = " Sets color to windowed text colors as defined by "
ac_Msg[02] = " the configuration database. You can change the "
ac_Msg[03] = " colors via the GETCOLOR() function. "
DISPMSG(ac_Msg,3," WINDCOLR() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 35 && FAKELOCK
ac_Msg[01] = " Simulates a global network lock for runtime "
ac_Msg[02] = " testing of logic associated with network file "
ac_Msg[03] = " operations. "
ac_Msg[04] = " "
ac_Msg[05] = " FAKELOCK will force all of the VERNSIX.LIB network "
ac_Msg[06] = " functions (V_APPEND(), V_FLOCK(), V_RLOCK(), "
ac_Msg[07] = " V_USE()) to act as though they were unsuccessful. "
ac_Msg[08] = " This is useful for testing your program code to "
ac_Msg[09] = " recover from such failures. "
DISPMSG(ac_Msg,9," FAKELOCK ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 36 && V_APPEND()
ac_Msg[01] = " Adds a blank record to the currently selected file "
ac_Msg[02] = " or notifies user if unsuccessful. "
ac_Msg[03] = " "
ac_Msg[04] = " V_APPEND() will try to append a blank record to "
ac_Msg[05] = " the currently selected file. If it is "
ac_Msg[06] = " unsuccessful, a non-screen destructive message "
ac_Msg[07] = " stating 'Waiting for busy network. Press any key "
ac_Msg[08] = " to abort.' will appear on the screen and "
ac_Msg[09] = " V_APPEND() will continue to endlessly attempt to "
ac_Msg[10] = " append a blank record to the currently selected "
ac_Msg[11] = " database. If the user aborts the operation by "
ac_Msg[12] = " pressing a key, V_APPEND() will return a logical "
ac_Msg[13] = " value of false. If V_APPEND() returns a value of "
ac_Msg[14] = " false, its your job as the programmer to abort the "
ac_Msg[15] = " operation and recover properly. "
DISPMSG(ac_Msg,15," V_APPEND() ", " Press any key to continue ",5)
INKEY(0)
CASE n_opt = 37 && V_FLOCK()
ac_Msg[01] = " Locks the currently selected file or notifies the "
ac_Msg[02] = " user if unsuccessful. "
ac_Msg[03] = " "
ac_Msg[04] = " V_FLOCK() will try to lock the currently selected "
ac_Msg[05] = " file. If it is unsuccessful, a non-screen "
ac_Msg[06] = " destructive message stating 'Waiting for busy "
ac_Msg[07] = " network. Press any key to abort.' will appear on "
ac_Msg[08] = " the screen and V_FLOCK() will continue to "
ac_Msg[09] = " endlessly attempt to lock the currently selected "
ac_Msg[10] = " database. If the user aborts the operation by "
ac_Msg[11] = " pressing a key, V_FLOCK() will return a logical "
ac_Msg[12] = " value of false. If V_FLOCK() returns a value of "
ac_Msg[13] = " false, its your job as the programmer to abort the "
ac_Msg[14] = " operation and recover properly. "
DISPMSG(ac_Msg,14," V_FLOCK() ", " Press any key to continue ",5)
INKEY(0)
CASE n_opt = 38 && V_RLOCK()
ac_Msg[01] = " Locks the currently selected record or notifies "
ac_Msg[02] = " the user if unsuccessful. "
ac_Msg[03] = " "
ac_Msg[04] = " V_RLOCK() will try to lock the currently selected "
ac_Msg[05] = " record. If it is unsuccessful, a non-screen "
ac_Msg[06] = " destructive message stating 'Waiting for busy "
ac_Msg[07] = " network. Press any key to abort.' will appear on "
ac_Msg[08] = " the screen and V_RLOCK() will continue to "
ac_Msg[09] = " endlessly attempt to lock the currently selected "
ac_Msg[10] = " database. If the user aborts the operation by "
ac_Msg[11] = " pressing a key, V_RLOCK() will return a logical "
ac_Msg[12] = " value of false. If V_RLOCK() returns a value of "
ac_Msg[13] = " false, its your job as the programmer to abort the "
ac_Msg[14] = " operation and recover properly. "
DISPMSG(ac_Msg,14," V_RLOCK() ", " Press any key to continue ",5)
INKEY(0)
CASE n_opt = 39 && V_USE()
ac_Msg[01] = " Opens a file in the current work area or notifies "
ac_Msg[02] = " the user if unsuccessful. The file can have an "
ac_Msg[03] = " ALIAS specified as well as EXCLUSIVE use set on or "
ac_Msg[04] = " off. "
DISPMSG(ac_Msg,4," V_USE() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 45 && HELP
ac_Msg[01] = " HELP provides a non-screen-destructive help screen "
ac_Msg[02] = " based on the calling program and variable name. "
ac_Msg[03] = " Help screens can be added at any time after the "
ac_Msg[04] = " program is compiled, through the use of the "
ac_Msg[05] = " MAKEHLP procedure and are fully 'context' "
ac_Msg[06] = " sensitive. To see a demo of HELP press F1 at any "
ac_Msg[07] = " menu selection. "
DISPMSG(ac_Msg,7," HELP ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 46 && INITHELP()
ac_Msg[01] = " This function creates the necessary HELP files "
ac_Msg[02] = " (DBF, DBT and N?X) in the next available work "
ac_Msg[03] = " area. "
DISPMSG(ac_Msg,3," INITHELP() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 47 && MAKEHLP
GRABSCRN()
ac_Msg[01] = " Allows the developer to design a help screen after "
ac_Msg[02] = " the application is compiled. "
ac_Msg[03] = " "
ac_Msg[04] = " When this routine is called, you will see a box "
ac_Msg[05] = " appear on the screen. You should size the box "
ac_Msg[06] = " using the technique described in GETCOORD. "
ac_Msg[07] = " "
ac_Msg[08] = " When you have a box that is suitable for your help "
ac_Msg[09] = " window, press [RETURN]. At this point you may "
ac_Msg[10] = " edit the help text as you wish. When you are "
ac_Msg[11] = " done, press Ctrl-W. "
DISPMSG(ac_Msg,11," MAKEHLP ", " Press any key to continue ",5)
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " To see a demonstration of MAKEHLP, create a text "
ac_Msg[02] = " file called VERNSIX.DVP in the current directory "
ac_Msg[03] = " and then press ALT-H while VERNDEMO.EXE is running. "
DISPMSG(ac_Msg,3," MAKEHLP ", " Press any key to continue ",5)
INKEY(0)
PUTSCRN()
CASE n_opt = 50 && ADD_FLD()
ac_Msg[1] = " ADD_FLD() adds a field to a 'structure extended' database. "
ac_Msg[2] = " ADD_FLD() saves you from having to issue several APPEND "
ac_Msg[3] = " BLANKS and REPLACE statements when creating a 'structure "
ac_Msg[4] = " extended' database."
DISPMSG(ac_Msg,4," ADD_FLD() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 51 && OPEN_DBF()
ac_Msg[1] = " OPEN_DBF() uses a database dictionary to open a specified "
ac_Msg[2] = " database and all its associated index files. OPEN_DBF() "
ac_Msg[3] = " is primarily used to allow several different database "
ac_Msg[4] = " applications to access common databases and maintain "
ac_Msg[5] = " common index files without having to re-compile and link "
ac_Msg[6] = " each application."
DISPMSG(ac_Msg,6," OPEN_DBF() ", " Press any key to continue ")
INKEY(0)
CASE n_opt = 52 && SHOW_NTX()
GRABSCRN()
ac_Msg[01] = " Provides the programmer with a non-screen "
ac_Msg[02] = " desctructuve 'gas guage' type of chart to show the "
ac_Msg[03] = " user what percentage of the index operation is "
ac_Msg[04] = " complete. "
DISPMSG(ac_Msg,4," SHOW_NTX() ", " Press any key to continue ")
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " One of the biggest disadvantages of Clipper is the "
ac_Msg[02] = " inability to show the progress of an index "
ac_Msg[03] = " operation. While it can be argued that the hard "
ac_Msg[04] = " drive access light is sufficient to tell the user "
ac_Msg[05] = " that something is happening, a far greater number "
ac_Msg[06] = " of users will argue to the contrary. In fact, "
ac_Msg[07] = " several users have been known to turn the machine "
ac_Msg[08] = " off while in the middle of a large index "
ac_Msg[09] = " operation. SHOW_NTX() provides a user-friendly "
ac_Msg[10] = " 'gas gauge' type of display telling the user "
ac_Msg[11] = " exactly how things are progressing. "
ac_Msg[12] = " ══════════════════════════════════════════════════ "
ac_Msg[13] = " Press any key to see a demonstration of SHOW_NTX() "
DISPMSG(ac_Msg,13," SHOW_NTX() ", "",5)
INKEY(0)
PUTSCRN()
SHOW_NTX("SAMPLE","AUTHORLAST+AUTHORFRST")
*****
* SHOW_NTX() acts just like "INDEX ON" in that it locks the database
* so we need the following code to UNLOCK it
*****
BEGIN SEQUENCE
IF .NOT. V_USE("SAMPLE",.F.)
GRABSCRN()
ac_Msg[1] = "Could not gain access to 'SAMPLE.DBF'"
ac_Msg[2] = " "
ac_Msg[3] = " Program aborted! "
DISPMSG(ac_Msg,3,""," Press any key to continue ")
INKEY(0)
PUTSCRN()
BREAK
ENDIF
SET INDEX TO SAMPLE
END SEQUENCE
CASE n_opt = 53 && VEDIT()
ac_Msg[01] = " Emulates the dBASE III+ 'Edit' command by allowing "
ac_Msg[02] = " the user to page back and forth through the "
ac_Msg[03] = " database records and optionally editing the "
ac_Msg[04] = " selected record. "
ac_Msg[05] = " "
ac_Msg[06] = " VEDIT() is very useful for working with a 'flat' "
ac_Msg[07] = " database. VEDIT() controls all the moving around "
ac_Msg[08] = " inside your database and will handle SEEKs based "
ac_Msg[09] = " on a pressed key, etc. "
ac_Msg[10] = " ══════════════════════════════════════════════════ "
ac_Msg[11] = " Press any key to see a demonstration of VEDIT() "
DISPMSG(ac_Msg,11," VEDIT() ", "",5)
INKEY(0)
DO VEDITDEMO
CASE n_opt = 54 && VFILT()
GRABSCRN()
ac_Msg[01] = " Provides a non-screen-destructive user interface "
ac_Msg[02] = " to allow the user to select a list of fields, "
ac_Msg[03] = " logical connectives, and comparison constants from "
ac_Msg[04] = " pop up light bar windows. "
ac_Msg[05] = " "
ac_Msg[06] = " VFILT() draws information from the database open "
ac_Msg[07] = " in the work area currently selected when it is "
ac_Msg[08] = " invoked. "
DISPMSG(ac_Msg,8," VFILT() ", " Press any key to continue ")
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " VFILT() is designed to provide the uninitiated "
ac_Msg[02] = " user with an easy interface to 'filter' "
ac_Msg[03] = " specification building. It is database "
ac_Msg[04] = " independent and limits the choices available in "
ac_Msg[05] = " the light bar menus to those that are applicable "
ac_Msg[06] = " to the variable type selected. As the user "
ac_Msg[07] = " selects fields, relational operators and "
ac_Msg[08] = " comparison constants, the string VFILT() builds is "
ac_Msg[09] = " also displayed on the screen. "
DISPMSG(ac_Msg,9," VFILT() ", " Press any key to continue ")
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " VFILT() alone is not a powerful function but when "
ac_Msg[02] = " combined with the macro substitution capabilities "
ac_Msg[03] = " of Clipper, the two become very powerful indeed. "
ac_Msg[04] = " The string returned by VFILT() is suitable for "
ac_Msg[05] = " macro substitution in the SET FILTER TO command as "
ac_Msg[06] = " well as in any FOR clause in any Clipper command "
ac_Msg[07] = " supporting that clause (such as REPORT, SORT, "
ac_Msg[08] = " COPY, LIST, etc..). "
DISPMSG(ac_Msg,8," VFILT() ", " Press any key to continue ")
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " A demonstration of VFILT() can be found within the "
ac_Msg[02] = " VEDIT() demonstration."
DISPMSG(ac_Msg,2," VFILT() ", " Press any key to continue ")
INKEY(0)
PUTSCRN()
CASE n_opt = 55 && VPICK()
ac_Msg[01] = " Allows the user to select a record from currently "
ac_Msg[02] = " selected database. "
ac_Msg[03] = " ══════════════════════════════════════════════════ "
DISPMSG(ac_Msg,2," VPICK() ", " Press any key to see a demo of VPICK() ")
INKEY(0)
DO VPICKDEMO
CASE n_Opt = 60 && Color settings
GETCOLOR()
TEXTCOLR() && Reflect changes in color settings
CASE n_opt = 61 && Special Thanks
ac_Msg[01] = " A special note of thanks is due to my very good "
ac_Msg[02] = " friend Frank Grubbs, for his never ending support. "
ac_Msg[03] = " If it weren't for Frank's continuing testing and "
ac_Msg[04] = " support, this library would have never left my den. "
DISPMSG(ac_Msg,4,""," Press any key to continue ")
INKEY(0)
CASE n_opt = 62 && Ordering Information
GRABSCRN()
ac_Msg[01] = " If you purchased VERNSIX.LIB directly from FrontLine Software in "
ac_Msg[02] = " your own name for $39.95, then your copy is already registered "
ac_Msg[03] = " and you will receive all the benefits of registration. You do "
ac_Msg[04] = " not need to send in a registration form. "
ac_Msg[05] = " "
ac_Msg[06] = " If you received VERNSIX.LIB from a 'Users' Group', 'Software "
ac_Msg[07] = " Library', 'SIG', 'Bulletin Board', etc. and have paid a small "
ac_Msg[08] = " fee (usually either yearly dues or $3.00 to $10.00 per disk) you "
ac_Msg[09] = " have NOT acquired a registration. The fee you paid was for the "
ac_Msg[10] = " convenience of obtaining the diskette with VERNSIX.LIB on it. "
ac_Msg[11] = " The fee does NOT apply to the registration fee. "
DISPMSG(ac_Msg,11,""," Press any key to continue ",5)
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " If you received an evaluation copy of VERNSIX.LIB from FrontLine "
ac_Msg[02] = " Software for a fee of $5.00, you have NOT acquired a "
ac_Msg[03] = " registration. The $5.00 you paid was for the convenience of "
ac_Msg[04] = " obtaining the diskette with VERNSIX.LIB on it. However, this "
ac_Msg[05] = " $5.00 fee DOES apply toward your registration fee and you may "
ac_Msg[06] = " deduct it from the $39.95 fee when you register. "
ac_Msg[07] = " "
ac_Msg[08] = " You may register your copy by filling out the enclosed form and "
ac_Msg[09] = " mailing it to the listed address along with your check or money "
ac_Msg[10] = " order for $39.95 (Texas residents add 8% sales tax). "
DISPMSG(ac_Msg,10,""," Press any key to continue ",5)
INKEY(0)
PUTSCRN()
GRABSCRN()
ac_Msg[01] = " When you register your copy of VERNSIX.LIB, you will receive the "
ac_Msg[02] = " latest version without the ten second 'advertisemnet' in it. You "
ac_Msg[03] = " will also be granted a royalty free run-time license to use "
ac_Msg[04] = " VERNSIX.LIB in any of your applications. "
DISPMSG(ac_Msg,4,""," Press any key to continue ")
INKEY(0)
PUTSCRN()
CASE n_opt = 63 && Quit
IF ASK("Are you sure","YyNn") $ "Yy"
SET CURSOR ON
TEXTCOLR()
CLEAR
QUIT
ENDIF
ENDCASE
ENDDO
RETURN
*** EOF: VERNDEMO.PRG *******************************************************
************************************************
************************************************
** **
** Supporting procedures and functions follow **
** **
************************************************
************************************************
PROCEDURE VPICKDEMO
*****
* Demonstration of VPICK()
*****
PRIVATE c_FldList, n_retval
TEXTCOLR()
CLEAR
SET FILTER TO
GO TOP
c_FldList = "AUTHORLAST + [ ] + AUTHORFRST + [ ] + SUBSTR(TITLE,1,15)"
DO WHILE .T.
gn_StartRec = RECNO() && What record to start on?
n_retval = VPICK(5,5,15,c_FldList," VPICK() Demo ","",.T.)
DO CASE
CASE n_RetVal = 22 && [Insert]
APPEND BLANK
PICKEDIT()
CASE n_RetVal = 13 && [Return]
PICKEDIT()
CASE n_retval = 27 && [Esc]
EXIT
CASE n_retval = 28 && F1
DO HELP WITH "VPICKDEMO",10,"KEY"
CASE n_retval = 291 && ALT-H
DO MAKEHLP WITH "VPICKDEMO",10,"KEY"
ENDCASE
ENDDO
RETURN
*** EOF: VPICKDEMO **********************************************************
PROCEDURE PICKEDIT
*****
* Editing procedure for VPICKDEMO
*****
PRIVATE c_temp
TEXTCOLR()
CLEAR
@ 01,00 say [╒══════════════════════════════════════════════════════════════════════════════╕]
@ 02,00 say [│ Sample Library Database │]
@ 03,00 say [╞══════════════════════════════════════════════════════════════════════════════╡]
@ 04,00 say [│ About the author... │]
@ 05,00 say [│ Last Name: First Name: │]
@ 06,00 say [│ │]
@ 07,00 say [│ About the book... │]
@ 08,00 say [│ Title: │]
@ 09,00 say [│ Sub-Title: │]
@ 10,00 say [│ │]
@ 11,00 say [│ Publisher: City, St: │]
@ 12,00 say [│ │]
@ 13,00 say [│ Year: Class: Location: │]
@ 14,00 say [│ │]
@ 15,00 say [│ Comments... │]
@ 16,00 say [│ │]
@ 17,00 say [│ │]
@ 18,00 say [│ │]
@ 19,00 say [│ │]
@ 20,00 say [╞══════════════════════════════════════════════════════════════════════════════╡]
@ 21,00 SAY "│ F1 - Help End - End of line ^T - Del word Del - Del Char │"
@ 22,00 SAY "│ ESC - Abort Edit ^Home - First field ^Y - Del to EOL Ins - Insert │"
@ 23,00 SAY "│ Home - Beg of line ^End - Last field ^U - Ooops PgDn - Save │"
@ 24,00 say [╘══════════════════════════════════════════════════════════════════════════════╛]
IF RECNO() <= LASTREC()
c_temp="Record # "+LTRIM( STR(RECNO()) )
IF DELETED()
c_temp=c_temp+[*]
ELSE
c_temp=c_temp+[ ]
ENDIF
c_temp=c_temp+" of "+LTRIM( STR(RECCOUNT()) )+" "
@ 02,02 SAY c_temp
@ 05,14 get AUTHORLAST
@ 05,49 get AUTHORFRST
@ 05,65 get AUTHORMID
@ 08,14 get TITLE
@ 09,14 get SUBTITLE
@ 11,14 get PUBLISHER
@ 11,56 get CITYSTATE
@ 13,14 get YEAR
@ 13,32 get CLASS
@ 13,64 get LOCATION
@ 16,04 get COMMENT1
@ 17,04 get COMMENT2
@ 18,04 get COMMENT3
ELSE
c_temp = "No records in database"
GO BOTTOM
SKIP
@ 02,02 SAY c_temp
ENDIF
SET CURSOR ON
READ
SET CURSOR OFF
RETURN
*** EOF: PICKEDIT() *********************************************************
PROCEDURE VEDITDEMO
*****
* Demonstrate VEDIT() use
*****
PRIVATE c_Filter, n_RetVal, ac_Msg[4]
TEXTCOLR()
CLEAR
c_Filter = ""
SET FILTER TO
GO TOP
DISPTEXT() && Display normal text "shell"
DO WHILE .T.
DISPCURR() && Display the current record
gn_StartRec = RECNO()
n_RetVal = VEDIT(.T.)
DO CASE
CASE n_RetVal = 13 && [Return]
EDITCURR()
CASE n_RetVal = 22 && [Insert]
IF .NOT. V_APPEND()
ac_Msg[1] = " Could not append a blank record "
ac_Msg[2] = " Please try again later "
DISPMSG(ac_Msg,2,"","")
SET CURSOR OFF
INKEY(5)
ELSE
EDITCURR()
ENDIF
CASE n_RetVal = 7 && [Delete]
IF .NOT. V_RLOCK()
ac_Msg[1] = " Could not lock record "
ac_Msg[2] = " Please try again later "
DISPMSG(ac_Msg,2,"","")
SET CURSOR OFF
INKEY(5)
ELSE
IF DELETED()
RECALL
ELSE
DELETE
ENDIF
ENDIF
CASE n_RetVal = 27 && [Esc]
EXIT
CASE n_RetVal = 28 && F1
DO HELP WITH "VIEWSAMP",10,"KEY"
CASE n_RetVal = 291 && ALT-H
DO MAKEHLP WITH "VIEWSAMP",10,"KEY"
CASE n_RetVal = -9 && F10 Change colors
GETCOLOR()
TEXTCOLR()
CLEAR
DISPTEXT() && Reflect changes in color settings
CASE n_RetVal = -8 && F9 Selectively retrieve records
c_Filter = VFILT()
IF .NOT. EMPTY(c_Filter)
SET FILTER TO &c_Filter
ELSE
SET FILTER TO
ENDIF
ENDCASE
ENDDO
SET FILTER TO
RETURN
*** EOF: VEDITDEMO **********************************************************
FUNCTION DISPTEXT
*****
* Draws original screen for VEDIT() (the "text shell")
*****
TEXTCOLR()
CLEAR
@ 01,00 say [╒══════════════════════════════════════════════════════════════════════════════╕]
@ 02,00 say [│ Sample Library Database │]
@ 03,00 say [╞══════════════════════════════════════════════════════════════════════════════╡]
@ 04,00 say [│ About the author... │]
@ 05,00 say [│ Last Name: First Name: │]
@ 06,00 say [│ │]
@ 07,00 say [│ About the book... │]
@ 08,00 say [│ Title: │]
@ 09,00 say [│ Sub-Title: │]
@ 10,00 say [│ │]
@ 11,00 say [│ Publisher: City, St: │]
@ 12,00 say [│ │]
@ 13,00 say [│ Year: Class: Location: │]
@ 14,00 say [│ │]
@ 15,00 say [│ Comments... │]
@ 16,00 say [│ │]
@ 17,00 say [│ │]
@ 18,00 say [│ │]
@ 19,00 say [│ │]
@ 20,00 say [╞══════════════════════════════════════════════════════════════════════════════╡]
@ 21,00 SAY "│ │"
@ 22,00 SAY "│ │"
@ 23,00 SAY "│ │"
@ 24,00 say [╘══════════════════════════════════════════════════════════════════════════════╛]
CLEAR GETS
RETURN(.T.)
*** EOF: DISPTEXT() *********************************************************
FUNCTION DISPCURR
*****
* Display current record
*****
TEXTCOLR()
@ 02,61 SAY "*** View Mode ***"
DISPFLDS() && Eliminates redudant code
@ 21,00 SAY "│ Esc - Exit F10 - Colors Home - First Rtrn - Edit │"
@ 22,00 SAY "│ F1 - Help PgDn - Next End - Last Del - Delete │"
@ 23,00 SAY "│ F9 - Filter Pgup - Previous Alpha - Seek Ins - Append │"
CLEAR GETS
SET CURSOR OFF
RETURN(.T.)
*** EOF: VIEWSAMP ***********************************************************
FUNCTION EDITCURR
*****
* Edit current record
*****
TEXTCOLR()
@ 02,61 SAY "*** Edit Mode ***"
DISPFLDS() && Eliminates redudant code
@ 21,00 SAY "│ F1 - Help End - End of line ^T - Del word Del - Del Char │"
@ 22,00 SAY "│ ESC - Abort Edit ^Home - First field ^Y - Del to EOL Ins - Insert │"
@ 23,00 SAY "│ Home - Beg of line ^End - Last field ^U - Ooops PgDn - Save │"
SET CURSOR ON
READ
SET CURSOR OFF
RETURN(.T.)
*** EOF: EDITSAMP ***********************************************************
FUNCTION DISPFLDS
*****
* Common "@ SAY ... GET" routine for VIEW and EDIT modes
*****
PRIVATE c_temp
TEXTCOLR()
IF RECNO() <= LASTREC()
c_temp="Record # "+LTRIM( STR(RECNO()) )
IF DELETED()
c_temp=c_temp+[*]
ELSE
c_temp=c_temp+[ ]
ENDIF
c_temp=c_temp+" of "+LTRIM( STR(RECCOUNT()) )+" "
@ 02,02 SAY c_temp
@ 05,14 get AUTHORLAST
@ 05,49 get AUTHORFRST
@ 05,65 get AUTHORMID
@ 08,14 get TITLE
@ 09,14 get SUBTITLE
@ 11,14 get PUBLISHER
@ 11,56 get CITYSTATE
@ 13,14 get YEAR
@ 13,32 get CLASS
@ 13,64 get LOCATION
@ 16,04 get COMMENT1
@ 17,04 get COMMENT2
@ 18,04 get COMMENT3
ELSE
c_temp = "No records in database"
GO BOTTOM
SKIP
@ 02,02 SAY c_temp
ENDIF
RETURN(.T.)
*** EOF: DISPFLDS() *********************************************************